<!DOCTYPE html>
<html>
<head>
    <title>系统用户</title>
		<!--<#include "/header.html">-->
</head>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>系统用户</title>
    <link rel="stylesheet" href="${request.contextPath}/statics/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/plugins/font-awesome/css/font-awesome.min.css" media="all">
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
			<#if shiro.hasPermission("save")>
            <a class="layui-btn layui-btn layui-btn-xs btn btn-primary add"><i class="fa fa-plus"></i>&nbsp;新增</a>
			</#if>
			<#if shiro.hasPermission("demo:demo:update")>
            <a class="layui-btn layui-btn-xs layui-btn-warm btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
			</#if>
			<#if shiro.hasPermission("demo:demo:delete")>
            <a class="layui-btn layui-btn-xs layui-btn-danger btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
			</#if>
        </div>

        <table class="layui-hide" id="test" lay-filter="test"></table>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="print">打印</a>
    </div>
</script>
    </div>

  <!--  <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
														                    <div class="form-group">
                        <div class="col-sm-2 control-label">用户名</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="demo.username" placeholder="用户名"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">密码</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="demo.password" placeholder="密码"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">盐</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="demo.salt" placeholder="盐"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">邮箱</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="demo.email" placeholder="邮箱"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">手机号</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="demo.mobile" placeholder="手机号"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">状态  0：禁用   1：正常</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="demo.status" placeholder="状态  0：禁用   1：正常"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">部门ID</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="demo.deptId" placeholder="部门ID"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">创建时间</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="demo.createTime" placeholder="创建时间"/>
                        </div>
                    </div>
							            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>-->
</div>
<script src="${request.contextPath}/statics/layui/layui.js"></script>
<!--<script src="${request.contextPath}/statics/js/modules/demo/demo.js?_${.now?long}"></script>-->
</body>
<script>
    var baseURL = "../../";
    layui.use(['form', 'layedit', 'laydate','table','jquery'], function(){
        var table = layui.table;
        var $ = layui.jquery;
        data={};
        // data.username = '2';
        data.ceshi1 = 'ceshi1';
        data.ceshi2 = 'ceshi2';
        table.render({
            where:data
            ,elem: '#test'
            ,url: baseURL+'DemoController/list'
            ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增属性
            ,cols: [[
                { field: 'user_id', title: 'userId',  width: 50 },
                { field: 'username',title: '用户名',   width: 80 },
                { field: 'password',title: '密码',   width: 80 },
                { field: 'salt', title: '盐',  width: 80 },
                { field: 'email',title: '邮箱',  width: 80 },
                { field: 'mobile',title: '手机号',  width: 80 },
                { field: 'status',title: '状态  0：禁用   1：正常',   width: 80 },
                { field: 'deptId',title: '部门ID',   width: 80 },
                { field: 'method',title: '创建时间',  width: 80},
                {fixed: 'right', title: '操作', width: 180, toolbar: '#barDemo'}
            ]]
            , id: 'table'
            , page: true
            , height: 'full-50' //页面中表格的高度，减的数字是顶部检索条件栏的高度
        });
        //监听工具条按钮
        table.on('tool(test)', function (obj) {
            var data = obj.data;
            active[obj.event] ? active[obj.event].call(this, data) : '';
        });

        //所有方法写在这里
        var active = {
            //搜索重新加载表格
            reload: function (){
                table.reload('table', {
                    where: {
                    }
                });
            },
            //查看
            detail: function (data) {
                //查看
                console.log("查看【" + data.user_id+ "】");
                layer.open({
                    type: 2,
                    title: '查看' + data+'',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['380px', '90%'],
                    content: 'add.html?type=detail&user_id='+data.user_id //iframe的url
                });
            },
            //修改
            edit: function (data) {
                console.log("修改【" + data.user_id+ "】");
                layer.open({
                    type: 2,
                    title: '查看' + data+'',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['380px', '90%'],
                    content: 'add.html?type=edit&user_id='+data.user_id //iframe的url
                });

            },
        };
        $(".add").click(function () {
            //iframe层
            layer.open({
                type: 2,
                title: 'layer mobile页',
                shadeClose: true,
                shade: 0.8,
                area: ['380px', '90%'],
                content: 'add.html' //iframe的url
            });
        });
    });
</script>
</html>